package com.dormitory.service.impl;

import com.dormitory.dao.BuildingDao;
import com.dormitory.dao.impl.BuildingDaoImpl;
import com.dormitory.model.Building;
import com.dormitory.service.BuildingService;

import java.util.List;

public class BuildingServiceImpl implements BuildingService {
    private BuildingDao buildingDao = new BuildingDaoImpl();

    @Override
    public boolean addBuilding(Building building) {
        return buildingDao.save(building);
    }

    @Override
    public boolean updateBuilding(Building building) {
        return buildingDao.update(building);
    }

    @Override
    public boolean deleteBuilding(Integer buildingId) {
        return buildingDao.delete(buildingId);
    }

    @Override
    public Building getBuildingById(Integer buildingId) {
        return buildingDao.findById(buildingId);
    }

    @Override
    public List<Building> getAllBuildings() {
        return buildingDao.findAll();
    }

    @Override
    public List<Building> searchBuildings(String condition) {
        return buildingDao.findByCondition(condition);
    }
} 